/*
 * align.h
 *
 *  Created on: 2011-09-06
 *      Author: pawel
 */

#ifndef ALIGN_H_
#define ALIGN_H_
#include"backtrack/alignStrings.h"
#include"seqLettersFreq.h"
//#include<iostream>
#include<iosfwd>
#include"alignContainerF.h"
namespace bpp{
class BasicSequence;
}
//class alignContainerF;
struct optAlgThreadParam;

class align{
private:
	bpp::BasicSequence *queryPtr;
	std::string compSequenceName;
	btrack::alignStrings btrackedAlign;
	seqLettersFreq lettersFreq;
	int score;
	bool local;
	double identity;
	double similarity;
	double gaps;
	double eValue;
	double zScore;
	double bits;



public:
	/*
	 * align take ownership of compSeq
	 *after calling constructor compSeq will be NULL;
	 */
	align(bpp::BasicSequence* query,bpp::BasicSequence* &compSeq,const btrack::alignStrings &bal,const int score);
	~align();
	double getIdentity()const;
	double getSimilarity()const;
	double getGaps()const;
	double getEValue()const;
	double getZScore()const;
	double getBits()const;
	int getScore()const;
	bool isLocal()const;
	bpp::BasicSequence* getQuerySeqPtr()const;
	std::string& getCompSeqName();

	/*
	 * Compare functions
	 */
		static bool compareScore(align*a,align*b);
		static bool compareIdentity(align *a,align *b);
		static bool compareSimilarity(align *a,align *b);
		static bool compareGaps(align *a,align *b);
		static bool compareEValue(align *a,align *b);
		static bool compareZScore(align *a,align *b);
		static bool compareBits(align *a,align *b);

		friend std::ostream& operator<<(std::ostream&, alignContainerF&);
		friend void alignContainerF::calculateStats(size_t simulations,optAlgThreadParam thparam,size_t threadsNum);
};


#endif /* ALIGN_H_ */
